<?php
/**
 * 同步Lumesse登录帐号数据
 * @author dinglin
 */
apf_require_class('Oa_Job_Abstract');
apf_require_class("Bll_Flow_Lumesse");
class Oa_Job_Portal_InputLumesseLoginAccount extends Oa_Job_Abstract {
    private $write_db = "hroa_master";//写数据库
    public function run() {
        $this->log("开始同步Lumesse登录名".date('Y-m-d H:i:s'));

        $lumesse_user_user = Bll_Flow_Lumesse::get_instance()->Lumesse_User()->User();
        $users = $lumesse_user_user->getUsers();

        $this->_update_lums_account($users->user);
        $this->log("同步Lumesse登录名处理完".date('Y-m-d H:i:s'));
    }
    private function _update_lums_account($users){
        foreach($users as $user){
            $sql = "UPDATE lumesse SET lums_account='".$user->login."',lums_user_id=".$user->id." WHERE user_email = '".$user->email."'";
            $this->execute($sql,array(),$this->write_db);
        }
    }
}